﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="quanlydiemdoiqua.aspx.cs" MasterPageFile="~/Administrator/Admin.master" Inherits="Administrator_quanlydiemdoiqua" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function RowDblClick(sender, eventArgs) {
                sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
            }
        </script>
    </telerik:RadCodeBlock>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>                  
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="Label1" />
                    <telerik:AjaxUpdatedControl ControlID="Label2" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadGrid2">
                <UpdatedControls>
                 
                    <telerik:AjaxUpdatedControl ControlID="RadGrid2" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
           
            
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
    <br />
   
    <div>
        <asp:Label ID="Label1" runat="server" EnableViewState="False" Font-Bold="True" ForeColor="#FF8080"></asp:Label>
        <asp:Label ID="Label2" runat="server" EnableViewState="False" Font-Bold="True" ForeColor="#00C000"></asp:Label>
    </div>
    <br/>
   
    <telerik:RadGrid ID="RadGrid2" runat="server" Skin="Office2007" 
        CssClass="RadGrid" GridLines="None"
        AllowPaging="True" PageSize="20" AllowSorting="True" AutoGenerateColumns="False"
        ShowStatusBar="true" AllowAutomaticDeletes="True" AllowAutomaticInserts="True"
        AllowAutomaticUpdates="True" DataSourceID="SqlDataSource2" 
        HorizontalAlign="NotSet"  >
        <MasterTableView CommandItemDisplay="TopAndBottom" DataSourceID="SqlDataSource2"
            DataKeyNames="GiftBackage_id" EditMode="PopUp">
            <Columns>
            <telerik:GridEditCommandColumn>
                </telerik:GridEditCommandColumn>
                <telerik:GridBoundColumn UniqueName="GiftBackage_Title" HeaderText="Tên gói quà" DataField="GiftBackage_Title">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn UniqueName="GiftBackage_Details" HeaderText="Mô t&#7843;" DataField="GiftBackage_Details">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn UniqueName="GiftBackage_Point" HeaderText="&#272;i&#7875;m c&#7847;n có" DataField="GiftBackage_Point">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn UniqueName="GiftBackage" HeaderText="Hình" DataField="GiftBackage">                
                </telerik:GridBoundColumn>
                <%--<telerik:GridTemplateColumn>
                <ItemTemplate>
                            <telerik:RadBinaryImage runat="server" ID="RadBinaryImage1" DataValue='<%#Eval("Data") %>'
                                AutoAdjustImageControlSize="false" Height="80px" Width="80px" ToolTip='<%#Eval("Name", "Photo of {0}") %>'
                                AlternateText='<%#Eval("Name", "Photo of {0}") %>' />
                        </ItemTemplate>
                </telerik:GridTemplateColumn>--%>
                <telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="column">
                </telerik:GridButtonColumn>
            </Columns>
            <EditFormSettings CaptionFormatString="Edit GiftBackage_id: {0}"
                CaptionDataField="GiftBackage_id" EditFormType="Template" PopUpSettings-Modal="true">
                <FormTemplate>
                    <table id="Table1" cellspacing="1" cellpadding="1" width="250" border="0">
                        <tr>
                            <td>
                            </td>
                            <td>
                            </td>  <%-- SelectCommand="SELECT [GiftBackage_Id] , [GiftBackage_Title] ,  [GiftBackage_Details] , [GiftBackage_Point],[image] FROM [[GiftBackage]" --%>
                        </tr>
                        <tr>
                            <td>
                               Tên gói quà:
                            </td>
                            <td>
                                <asp:TextBox ID="TextBox10" Text='<%# Bind( "GiftBackage_Title") %>' runat="server">
                                </asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Mô t&#7843;:
                            </td>
                            <td>
                                <asp:TextBox ID="TextBox11" TextMode="MultiLine" Text='<%# Bind( "GiftBackage_Details") %>' runat="server">
                                </asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                               &#272;i&#7875;m c&#7847;n có:
                            </td>
                            <td>
                                <asp:TextBox ID="TextBox12" Text='<%# Bind( "GiftBackage_Point") %>' runat="server">
                                </asp:TextBox> <span style="color: #FF0000">
(Ch&#7881; &#272;&#432;&#7907;c nh&#7853;p s&#7889;)</span>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <hr />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Hình :
                            </td>
                            <td>
                                <asp:FileUpload ID="FileUpload1" runat="server" />
                            </td>
                        </tr>                     
                       
                    </table>
                    <table style="width: 100%">
                        <tr>
                            <td align="right" colspan="2">
                                <asp:Button ID="Button1" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                    runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' OnClick="Button1_Click">
                                </asp:Button>&nbsp;
                                <asp:Button ID="Button2" Text="Cancel"  runat="server" CausesValidation="False" CommandName="Cancel">
                                </asp:Button>
                            </td>
                        </tr>
                    </table>
                </FormTemplate>
            </EditFormSettings>
        </MasterTableView>
        <ClientSettings>
            <ClientEvents OnRowDblClick="RowDblClick" />
        </ClientSettings>
    </telerik:RadGrid>
    <br />        
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:up1vnConnectionString %>"
        DeleteCommand="DELETE FROM [GiftBackage] WHERE [GiftBackage_Id] = @GiftBackage_Id" InsertCommand="INSERT INTO [GiftBackage] ([GiftBackage_Title],[GiftBackage_Details],[GiftBackage_Point],[image]) VALUES (@GiftBackage_Title, @GiftBackage_Details, @GiftBackage_Point, @image)"
        SelectCommand="SELECT [GiftBackage_Id] , [GiftBackage_Title] ,  [GiftBackage_Details] , [GiftBackage_Point],[image] FROM [GiftBackage]" UpdateCommand="UPDATE [GiftBackage] SET [GiftBackage_Title] = @GiftBackage_Title, [GiftBackage_Details] = @GiftBackage_Details, [GiftBackage_Point] = @GiftBackage_Point, [image] = @image WHERE [GiftBackage_Id] = @GiftBackage_Id">
        <DeleteParameters>
       <%-- SELECT  PointBackage_Name as ten  , PointBackage_Id, PointBackage_Point, PointBackage_award1, PointBackage_award2, PointBackage_award3,cumulative_time FROM PointBackage--%>
            <asp:Parameter Name="PointBackage_id" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>     
        <asp:Parameter Name="GiftBackage_Id" Type="Int32" />      
           <asp:Parameter Name="GiftBackage_Title" Type="String"  />
            <asp:Parameter Name="GiftBackage_Details" Type="String"  />
             <asp:Parameter Name="GiftBackage_Point" Type="Int32"  />  
            <asp:Parameter Name="image" Type="String" Direction="Input"  />           
        </InsertParameters>
        <UpdateParameters>    
           <asp:Parameter Name="GiftBackage_Id" Type="Int32" />      
           <asp:Parameter Name="GiftBackage_Title" Type="String"  />
            <asp:Parameter Name="GiftBackage_Details" Type="String"  />
             <asp:Parameter Name="GiftBackage_Point" Type="Int32"  />  
            <asp:Parameter Name="image" Type="String" />    
        </UpdateParameters>
    </asp:SqlDataSource>
    <!-- content end -->
    
</asp:Content>